import { configureStore,getDefaultMiddleware } from "@reduxjs/toolkit";
import TodosReducer, { TODOS_FEATURE_KEY } from "./todos";
import counterReducer from '../features/counter/counterSlice';
import logger from "redux-logger"

// 创建store，以前是createStore()
export default configureStore({
  reducer: {
    // 相当于combineReducers所做的事情，将一个个小的reducer组合成一个大的reducer
    counter: counterReducer,
    [TODOS_FEATURE_KEY]: TodosReducer,
  },
  devTools: process.env.NODE_ENV !== "production", // 是否开启redux调试工具
  middleware: [...getDefaultMiddleware(logger)]
});
